import { useSetting } from "./utils/useSetting"

export function renderLogin() {

    const setting = useSetting()

    if (!Array.isArray(setting.type)) {
        setting.type = [
            setting.type
        ].filter(it => !!it)
    }

    ui.layout(`<LinearLayout  layout_width="match_parent" layout_height="match_parent" orientation="vertical" paddingLeft="4sp" paddingRight="4sp">
    
        <ScrollView layout_width="match_parent" layout_height="wrap_content" paddingTop="4sp">
            <LinearLayout layout_width="match_parent" layout_height="wrap_content" orientation="vertical" paddingTop="4sp">
                <TextView text="${setting.id || ""}" w="*" gravity="center" textSize="24sp" layout_width="wrap_content" layout_height="wrap_content"/>
                <button style="Widget.AppCompat.Button.Colored" text="已授权" id="login"></button>
            </LinearLayout>
        </ScrollView>
    </LinearLayout>`)
    const login = ui.findView("login")
    login?.on("click", () => {
        console.log(`登陆`)
    })
}
